"""
应用配置管理
"""
from pydantic_settings import BaseSettings
from pydantic import Field

class Settings(BaseSettings):
    """应用设置类"""
    # 数据库配置
    database_url: str = Field(..., env="DATABASE_URL")

    # JWT 配置
    secret_key: str = Field(..., env="SECRET_KEY")
    algorithm: str = Field(default="HS256", env="ALGORITHM")
    access_token_expire_minutes: int = Field(default=30, env="ACCESS_TOKEN_EXPIRE_MINUTES")

    # 应用配置
    debug: bool = Field(default=False, env="DEBUG")

    # 服务器配置
    host: str = Field(default="0.0.0.0", env="HOST")
    port: int = Field(default=8001, env="PORT")

    # 前端URL配置（用于CORS）
    frontend_url: str = Field(default="", env="FRONTEND_URL")

    class Config:
        env_file = ".env"

# 全局配置实例
settings = Settings()